package com.aivin.lib_widget.base;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.Toast;

import androidx.annotation.Nullable;

import com.aivin.lib_widget.R;
import com.aivin.lib_widget.dialog.LoadingDialog;
import com.gyf.immersionbar.ImmersionBar;
import com.wind.me.xskinloader.SkinInflaterFactory;


public abstract class BaseActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        //干涉xml中view的创建，实现xml中资源换肤(在setContentView之前执行)
        SkinInflaterFactory.setFactory(this);

        super.onCreate(savedInstanceState);
        ImmersionBar.with(this).init();
    }

    protected void toastMsg(String msg){
        Toast.makeText(this , msg , Toast.LENGTH_SHORT).show();
    }

    private LoadingDialog loadingDialog;
    public void showLoadDialog2(Context context  ) {
        if (loadingDialog == null) {
            loadingDialog = new LoadingDialog(context);
        }
        loadingDialog.show();
        loadingDialog.setMsg( getString(R.string.str_isloading));
    }

    public void hideLoadDialog2() {
        if (loadingDialog != null) {
            loadingDialog.dismiss();
        }
    }

    private void test(){
//        RecyclerViewFastScroller;
    }
}
